#include "start-game-scene.h"
#include "ui_start-game-scene.h"

StartGameScene::StartGameScene(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::StartGameScene)
{
    initUi();

    initData();

    initUiData();

    initConnect();
}

StartGameScene::~StartGameScene()
{
    delete ui;

    delete start_button;
}

void StartGameScene::paintEvent(QPaintEvent *event)
{
    // 创建画家对象
    QPainter painter(this);

    // 加载主界面背景图片
    QPixmap pixmap_background(START_GAME_SCENE);
    painter.drawPixmap(0, 0, pixmap_background);

    // 加载主界面游戏标题
    QPixmap pixmap_title(TITLE);
    pixmap_title = pixmap_title.scaled( pixmap_title.width() * 0.6, pixmap_title.height() * 0.6);
    painter.drawPixmap(30, 30, pixmap_title);
}


void StartGameScene::initUi()
{
    ui->setupUi(this);

    // 创建开始按钮
    this->start_button = new SlideButton(START_BUTTON, START_BUTTON_SOUND, 15);
    this->start_button->setParent(this);
    this->start_button->move(this->width() * 0.5 - start_button->width() * 0.5, this->height() * 0.7);
}


void StartGameScene::initData()
{

}

void StartGameScene::initUiData()
{
    // 设置窗口固定大小
    this->setFixedSize(315, 560);

    // 设置窗口图标
    this->setWindowIcon(QPixmap(GOLD_COIN));
}

void StartGameScene::initConnect()
{

}
